/*    */ package com.equipmentmanage.service.impl;
/*    */ 
/*    */ import com.equipmentmanage.dao.EquipmentDao;
import com.equipmentmanage.dao.RepairDao;
import com.equipmentmanage.model.Equipment;
import com.equipmentmanage.model.PageBean;
import com.equipmentmanage.model.Repair;
import com.equipmentmanage.service.EquipmentService;

/*    */ import java.util.List;
/*    */ import javax.annotation.Resource;
import org.springframework.stereotype.Service;
/*    */ 
/*    */ @Service("equipmentService")
/*    */ public class EquipmentServiceImpl
/*    */   implements EquipmentService
/*    */ {
/*    */ 
/*    */   @Resource
/*    */   private EquipmentDao equipmentDao;
/*    */ 
/*    */   @Resource
/*    */   private RepairDao repairDao;
/*    */ 
/*    */   public void add(Equipment equipment)
/*    */   {
/* 31 */     this.equipmentDao.add(equipment);
/*    */   }
/*    */ 
/*    */   public void update(Equipment equipment) {
/* 35 */     this.equipmentDao.update(equipment);
/*    */   }
/*    */ 
/*    */   public void delete(int id) {
/* 39 */     this.equipmentDao.delete(id);
/*    */   }
/*    */ 
/*    */   public List<Equipment> find(PageBean pageBean, Equipment s_equipment) {
/* 43 */     return this.equipmentDao.find(pageBean, s_equipment);
/*    */   }
/*    */ 
/*    */   public int count(Equipment s_equipment) {
/* 47 */     return this.equipmentDao.count(s_equipment);
/*    */   }
/*    */ 
/*    */   public Equipment loadById(int id) {
/* 51 */     return this.equipmentDao.loadById(id);
/*    */   }
/*    */ 
/*    */   public boolean existEquipmentByTypeId(int typeId) {
/* 55 */     return this.equipmentDao.existEquipmentByTypeId(typeId);
/*    */   }
/*    */ 
/*    */   public void addRepair(int id, String userMan) {
/* 59 */     Repair repair = new Repair();
/* 60 */     repair.setEquipmentId(id);
/* 61 */     repair.setUserMan(userMan);
/* 62 */     this.repairDao.add(repair);
/* 63 */     Equipment equipment = this.equipmentDao.loadById(id);
/* 64 */     equipment.setState(2);
/* 65 */     this.equipmentDao.update(equipment);
/*    */   }
/*    */ 
/*    */   public void updateRepair(int id, String repairMan, boolean success) {
/* 69 */     Repair repair = new Repair();
/* 70 */     repair.setEquipmentId(id);
/* 71 */     repair.setRepairMan(repairMan);
/* 72 */     Equipment equipment = this.equipmentDao.loadById(id);
/* 73 */     if (success) {
/* 74 */       repair.setState(Integer.valueOf(1));
/* 75 */       equipment.setState(1);
/*    */     } else {
/* 77 */       repair.setState(Integer.valueOf(2));
/* 78 */       equipment.setState(3);
/*    */     }
/* 80 */     this.repairDao.update(repair);
/* 81 */     this.equipmentDao.update(equipment);
/*    */   }
/*    */ }

/* Location:           C:\Users\arcgis\Desktop\新建文件夹\a0\[www.java1234.com]《SpringMvc设备管理系统》第零讲源码及文档\EquipmentSys\WEB-INF\classes\
 * Qualified Name:     com.java1234.service.impl.EquipmentServiceImpl
 * JD-Core Version:    0.6.1
 */